package org.budo.support.java.map;

import java.util.LinkedHashMap;

/**
 * @author limingwei2
 */
public class FixedSizeLinkedHashMap<K, V> extends LinkedHashMap<K, V> {
    private static final long serialVersionUID = 7458189069403752L;

    private Integer fixedSize;

    public FixedSizeLinkedHashMap(Integer fixedSize) {
        this.fixedSize = fixedSize;
    }

    protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest) {
        return this.size() > this.fixedSize;
    }
}